<#include "/include/macros.ftl">
<@header></@header>
<div class="clearfix"></div>
<div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">考勤管理</li>
        </ol>
        <div class="x_panel">
            <div class="x_content">
                <div class="<#--table-responsive-->">
                    <div class="btn-group hidden-xs" id="toolbar">
                    	<@shiro.hasPermission name="course:add">
                        <button id="btn_add1" type="button" class="btn btn-default" title="新增课程">
                            <i class="fa fa-plus"></i> 新增
                        </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="course:batchRefer">
                            <button id="btn_refer_ids" type="button" class="btn btn-default" title="提交选中">
                                <i class="fa fa-check"></i> 批量提交
                            </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="course:batchApprove">
                            <button id="btn_approve_ids" type="button" class="btn btn-default" title="审批选中">
                                <i class="fa fa-tags"></i> 批量审批
                            </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="course:batchDelete">
                            <button id="btn_delete_ids" type="button" class="btn btn-default" title="删除选中">
                                <i class="fa fa-trash-o"></i> 批量删除
                            </button>
                        </@shiro.hasPermission>
                        <@shiro.hasPermission name="course:batchApprove">
                            <button id="btn_oaview_ids" type="button" class="btn btn-default" title="查看选中">
                                <i class="fa fa-blind"></i> 考勤预览
                            </button>
                        </@shiro.hasPermission>
                        
                        <@shiro.hasPermission name="course:batchApprove">
                            <button id="btn_oasum_ids" type="button" class="btn btn-default" title="查看选中">
                                <i class="fa fa-info"></i> 考勤汇总
                            </button>
                        </@shiro.hasPermission>
                        
                        <div class="pull-right search">
                       <input type='text' class="form-control" required="required" id="startEndDate" name="startEndDate" placeholder="请输入日期" />
                       </div>
                       
                    </div>
                    <table id="tablelist">
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--弹框-->
<div class="modal fade bs-example-modal-sm" id="selectRole" tabindex="-1" role="dialog" aria-labelledby="selectRoleLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="selectRoleLabel">分配资源权限</h4>
            </div>
            <div class="modal-body">
                <form id="boxRoleForm">
                    <div class="zTreeDemoBackground left">
                        <ul id="treeDemo" class="ztree"></ul>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
            </div>
        </div>
    </div>
</div>
<!-- 审批意见框 -->
<div class="modal fade" id="approveResultModalId" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="addroleLabel">请填写审批意见</h4>
            </div>
            <div class="modal-body">
            	  <form id="approveResultForm" class="form-horizontal form-label-left" novalidate>
	            		 <input type="hidden" name="id" id="whosapproveid">
	            		 <label class="control-label col-md-3 col-sm-3 col-xs-12" for="intEvaluation">审批意见:<span class="required">*</span></label>
	                     <div class="col-md-6 col-sm-6 col-xs-12">
	                     
	                     <textarea rows="6" cols="50" id="remark" name="remark">同意</textarea>
	                    </div>
                    </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
                <button type="button" class="btn btn-success btn-approve-yes" data-dismiss="modal"><i class="fa fa-hand-o-up"> 审批</i></button>
                <button type="button" class="btn btn-success btn-approve-no" data-dismiss="modal"><i class="fa fa-hand-o-down"> 驳回</i></button>
            </div>
        </div>
    </div>
</div>

<!--/弹框-->
<div class="modal fade" id="addOrUpdateModal" tabindex="-1" role="dialog" aria-labelledby="addcourseLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="addcourseLabel">添加课时</h4>
            </div>
            <div class="modal-body">
                <form id="addOrUpdateForm" class="form-horizontal form-label-left" novalidate>
                    <input type="hidden" name="id" id="id">
                    <input type="hidden" name="inOuter" id="inOuter">
                    <input type="hidden" name="level" id="level" value="<#if user?exists>${user.level?if_exists}</#if>">
                     <input type="hidden" name="status" id="status">
                    <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">老师名称: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                           <input type="hidden" class="form-control col-md-7 col-xs-12" name="teaName" id="teaName" required="required" readonly  placeholder="老师名称" value="<#if user?exists>${user.username?if_exists}</#if>"/>
                            <input type="text" class="form-control col-md-7 col-xs-12" name="nickName" id="nickName" required="required" readonly  disabled placeholder="老师名称" value="<#if user?exists>${user.nickname?if_exists}</#if>"/>
                        </div>
                    </div>
                    <div class="item form-group">
                         <label class="control-label col-md-3 col-sm-3 col-xs-12" for="courseId">课程名称:<span class="required">*</span></label>
	                     <div class="col-md-6 col-sm-6 col-xs-12">
	                            <select name="courseId" id="courseId" class="form-control col-md-7 col-xs-12" required="required">
	                            	<option value="">请选择</option>
	                                		<@yyTag method="dicts" dictType="COURSETYPE">
			                                    <#if dicts?? && dicts?size gt 0>
			                                        <#list dicts as dict>
			                                            <option value="${dict.dictTypeId}">${dict.dictTypeId}-${dict.dictTypeName}</option>
			                                        </#list>
			                                    <#else>
			                                        <option value="">无</option>
			                                    </#if>
			                                </@yyTag>
	                            </select>
	                    </div>
	                    
                    </div>
                     <div class="item form-group">
                        
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="birthday">工作日期 <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type='text' class="form-control form_datetime1" required="required" id="workDate" name="workDate" placeholder="请输入上班日期" />
                        </div>
                        
                    </div>
                    
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="description">上课时间: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="startTime" id="startTime" required="required"  readonly placeholder="上课时间"/>
                        </div>
                    </div>
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="description">下课时间: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <input type="text" class="form-control col-md-7 col-xs-12" name="endTime" id="endTime" required="required" readonly placeholder="下课时间"/>
                        </div>
                    </div>
                    
                     <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="description">上课孩子: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
	                            <select name="childId" id="childId" class="form-control col-md-7 col-xs-12" required="required">
	                            	<option value="">请选择</option>
	                                		<@childTag method="children" dictType="COURSETYPE">
			                                    <#if children?? && children?size gt 0>
			                                        <#list children as child>
			                                            <option value="${child.childId}" data-inOuter="${child.inOuter}">${child.childName}</option>
			                                        </#list>
			                                    <#else>
			                                        <option value="">无</option>
			                                    </#if>
			                                </@childTag>
	                            </select>
	                    </div>
	                    
                    </div>
                   <!--  <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="available">审批状态: <span class="required">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                            <select name="status" id="status" required="required" class="form-control col-md-7 col-xs-12">
                                <option value="">请选择</option>
                                <option value="0">待提交</option>
                                <option value="1" selected="selected">待审核</option>
                                <option value="2" selected="selected">已通过</option>
                                <option value="9" selected="selected">被打回</option>
                            </select>
                        </div>
                    </div> -->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
                <button type="button" class="btn btn-success addOrUpdateBtn"><i class="fa fa-save"> 保存</i></button>
            </div>
        </div>
    </div>
</div>
<!--/添加角色弹框-->
<@footer>
    <script>
        /**
         * 操作按钮
         * @param code
         * @param row
         * @param index
         * @returns {string}
         */
        function operateFormatter(code, row, index) {
            var trId = row.id;
            var operateBtn = [
                '<@shiro.hasPermission name="course:edit"><a class="btn btn-xs btn-primary btn-update1" data-id="' + trId + '"><i class="fa fa-edit"></i>编辑</a></@shiro.hasPermission>'
            ];
             operateBtn.push('<@shiro.hasPermission name="course:delete"><a class="btn btn-xs btn-danger btn-remove" data-id="' + trId + '"><i class="fa fa-trash-o"></i>删除</a></@shiro.hasPermission>');
             operateBtn.push('<@shiro.hasPermission name="course:refer"><a class="btn btn-xs btn-info btn-refer" data-id="' + trId + '"><i class="fa fa-check"></i>提交</a></@shiro.hasPermission>');
             operateBtn.push('<@shiro.hasPermission name="course:approve"><a class="btn btn-xs btn-info btn-approve" data-id="' + trId + '"><i class="fa fa-circle-thin"></i>审批</a></@shiro.hasPermission>');
            return operateBtn.join('');
        }
         $('#workDate').datetimepicker({
   			 language:  'zh-CN',  
   			 minView: "month",//设置只显示到月份
   		     format: 'yyyy-mm-dd',
             ignoreReadonly: true,
             allowInputToggle: true,
             autoclose:true,//选中关闭
             initialDate:new Date(),
             todayBtn: true,
             //startDate:new Date(),
             pickerPosition: "bottom-left"
         });
         
         
         $('input[name="startEndDate"]').daterangepicker({
             format: 'YYYY-MM-DD',
             startDate: moment().startOf('month'),
             endDate: moment().endOf('month'),
           ranges: {
 		        '今日': [moment().startOf('day'), moment()],
 		        '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
 		        '最近7日': [moment().subtract('days', 6), moment()],
 		        '最近30日': [moment().subtract('days', 29), moment()],
 		        '上个月':[moment().month(moment().month() - 1).startOf('month'),moment().month(moment().month() - 1).endOf('month')],
 		        '本月':[moment().month(moment().month()).startOf('month'),moment().month(moment().month()).endOf('month')]
 		    },
           dateLimit: {
 		        days: 30
 		  }, //起止时间的最大间隔   
           locale: {
                 applyLabel: '确定',
                 cancelLabel: '取消',
                 fromLabel: '起始时间',
                 toLabel: '结束时间',
                 customRangeLabel: '手动选择',
                 daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                 monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                     '七月', '八月', '九月', '十月', '十一月', '十二月'
                 ],
                 firstDay: 1
             }
         },
         
         /* var queryParams=function(params) {      
         	var temp = {    
         			offset: params.offset,  
         			pageSize:this.pageSize,          
         			pageNumber:this.pageNumber,  
         			startDate:moment().startOf('month').format('YYYY-MM-DD 00:00:00') ,
         			endDate: moment().endOf('month').format('YYYY-MM-DD 00:00:00'),
         			length: 6      
         			};      
         	return temp;  
         }; */
         
         function(start, end, label) {
                 var opt = {
                         url: "/teacher/list",
                         silent: true,
                         query:{
                         	startDate:start.format('YYYY-MM-DD 00:00:00'),
                         	endDate: end.format('YYYY-MM-DD 00:00:00')
                         }
                 };
         	$("#tablelist").bootstrapTable('refresh', opt);
         });
         
         //$("#workDate").datetimepicker("setDate", new Date());
         
        // $('#workDate').attr("value",new Date().format("yyyy-MM-dd"));
        
        
            function getWriteDownDetail(url,row){
                //首先创建一个form表单  
                var tempForm = document.createElement("form");    
                tempForm.id="tempForm1";  
                //制定发送请求的方式为post  
                tempForm.method="post";   
                //此为window.open的url，通过表单的action来实现  
                tempForm.action=url;  
                //利用表单的target属性来绑定window.open的一些参数（如设置窗体属性的参数等）  
                tempForm.target="_blank";   
                //创建input标签，用来设置参数 
                
                	var hideInput = document.createElement("input");   
                	hideInput.type="hidden";    
                    hideInput.name= "username";  
                    hideInput.value= "${user.userType?if_exists}"; 
                    tempForm.appendChild(hideInput);
         
                //将此form表单添加到页面主体body中 
                document.body.appendChild(tempForm); 
                //手动触发，提交表单  
                tempForm.submit();
                //从body中移除form表单  
                document.body.removeChild(tempForm);  
            }
        
        $("#btn_oaview_ids").click(function () {
        	
        	
        	getWriteDownDetail('/teacher/viewTeacherOA');
        	
        });
        
		$("#btn_oasum_ids").click(function () {
        	
        	
        	getWriteDownDetail('/teacher/sumTeacherOA');
        	
        });
        
        
        /* 批量提交课程去审批 */
          $("#btn_refer_ids").click(function () {
              var selectedId = getSelectedId();
              if (!selectedId || selectedId == '[]' || selectedId.length == 0) {
                  $.alert.error("请至少选择一条记录");
                  return;
              }
              refer(selectedId);
          });

          /* 提交审批 */
          $('#tablelist').on('click', '.btn-refer', function () {
              var $this = $(this);
              var selectedId = $this.attr("data-id");
              refer(selectedId);
          });
          
          function refer(ids){
        	  $.alert.confirm("确定提交课程审批？提交之后不可修改", function () {
                  $.ajax({
                      type: "post",
                      url: "/teacher/refer",
                      traditional: true,
                      data: {'ids': ids},
                      success: function (json) {
                          $.alert.ajaxSuccess(json);
                          $.tableUtil.refresh();
                      },
                      error: $.alert.ajaxError
                  });
              }, function () {

              }, 5000);
          }
                
          /* 修改 */
          $('#tablelist').on('click', '.btn-update1', function () {
              var $this = $(this);
              var courseId = $this.attr("data-id");
              $.ajax({
                  type: "post",
                  url: "/teacher/get/"+courseId,
                  success: function (json) {
                      var info = json.data;
                      // console.log(info);
                      resetForm(info);
                      $("#addOrUpdateModal").modal('show');
                      $("#addOrUpdateModal").find(".modal-dialog .modal-content .modal-header h4.modal-title").html("修改课程");
                      
                      $(".addOrUpdateBtn").unbind('click');
                      
                      $(".addOrUpdateBtn").click(function () {
                      	var t = $('#addOrUpdateForm').serializeArray();
                          if (validator.checkAll($("#addOrUpdateForm"))) {
                        	  $("#inOuter").val($("#childId").find("option:selected").attr("data-inOuter"));
                        	  $.ajax({
                                  type: "post",
                                  url: "/teacher/edit",
                                  data: $("#addOrUpdateForm").serialize(),
                                  success: function (json) {
                                      $.alert.ajaxSuccess(json);
                                      $("#addOrUpdateModal").modal('hide');
                                      $.tableUtil.refresh();
                                  },
                                  error: $.alert.ajaxError
                              });
                          }
                      })
                      $(".addOrUpdateBtn").show();

                  },
                  error: $.alert.ajaxError
              });
          });
          
        $("#btn_add1").click(function () {
                    $("#addOrUpdateModal").modal('show');
                    $("#addOrUpdateModal").find(".modal-dialog .modal-content .modal-header h4.modal-title").html("添加课时");

                    $("#courseId").unbind('change');
                    $("#courseId").change(function () {  
                    	var ss = $(this).children('option:selected').val();  
                    	  $.ajax({
                              type: "post",
                              url: '/teacher/courseTime/'+ss,
                              success: function (json) {
                                  var info = json.data;
                                  $('#startTime').val(info.dictTypeComment);
                                  $('#endTime').val(info.dictTypeRemark);
                                  
                              }
                          });
                    	  
                    })
                    //$(".form_datetime1").datetimepicker({format: 'yyyy-mm-dd'});
                    $("#id").val('');
                    $("#courseId").val('');
                    $('#workDate').attr("value",new Date().format("yyyy-MM-dd"));
                    
                    
                  
                    
                    $(".addOrUpdateBtn").unbind('click');
                    
                    $(".addOrUpdateBtn").click(function () {
                    	
                    $("#inOuter").val($("#childId").find("option:selected").attr("data-inOuter"));
                    if (validator.checkAll($("#addOrUpdateForm"))) {
                        $.ajax({
                            type: "post",
                            url: "/teacher/add",
                            data: $("#addOrUpdateForm").serialize(),
                            success: function (json) {
                                $.alert.ajaxSuccess(json);
                                $("#addOrUpdateModal").modal('hide');
                                $.tableUtil.refresh();
                            },
                            error: $.alert.ajaxError
                        });
                    }
                    });
                    
                    $(".addOrUpdateBtn").show();
                });
        
        $(function () {
            var options = {
                url: "/teacher/list",
                getInfoUrl: "/teacher/get/{id}",
                updateUrl: "/teacher/edit",
                removeUrl: "/teacher/remove",
                createUrl: "/teacher/add",
                saveRolesUrl: "/teacher/saveRoleResources",
                rowStyle :function (row, index){
                	var strclass = "";
                    if (row.status == '1') {
                        strclass = 'warning';
                    }else if (row.status == '2') {
                    	strclass = 'green';
                    }else if (row.status == '0'||row.status == '9') {
                        strclass = 'danger';
                    }
                	return { 'classes': strclass };
                },
                columns: [{
                    checkbox: true
                }, {
                    field: 'teaName',
                    title: '老师编号',
                    visible :false,
                    editable: false
                }, {
                    field: 'childId',
                    title: '孩子ID',
                    visible :false,
                    editable: false
                }, {
                    field: 'courseId',
                    title: '课程ID',
                    visible :false,
                    editable: false
                }, {
                    field: 'level',
                    title: '级别',
                    visible :false,
                    editable: false
                }, {
                    field: 'inOuter',
                    title: '孩子类别',
                    visible :false,
                    editable: false
                }, {
                    field: 'nickName',
                    title: '老师名',
                    editable: false
                }, {
                    field: 'workDate',
                    title: '工作日期',
                    editable: false
                }, {
                    field: 'courseName',
                    title: '课程名称',
                    editable: false
                }, {
                    field: 'startTime',
                    title: '上课时间',
                    editable: false
                }, {
                    field: 'endTime',
                    title: '下课时间',
                    editable: false
                }, {
                    field: 'childName',
                    title: '孩子名称',
                    editable: false
                }/* , {
                    field: 'price',
                    title: '课程价格',
                    editable: false
                } */, {
                    field: 'status',
                    title: '审批状态',
                    editable: false,
                    formatter: function (code) {
                    	if(code==0){
                    		return "待提交";
                    	}else if(code==1){
                    		return "待审核";
                    	}else if(code==2){
                    		return "已审核";
                    	}else if(code==9){
                    		return "被打回";
                    	}else{
                    		return "未知状态";
                    	}
                    }
                }, {
                    field: 'remark',
                    title: '审批意见',
                    editable: false
                }, {
                    field: 'operate',
                    title: '操作',
                    formatter: operateFormatter //自定义方法，添加操作按钮
                }],
                modalName: "课时"
            };
            //1.初始化Table
            $.tableUtil.init(options);
            //2.初始化Button的点击事件
            $.buttonUtil.init(options);

            
            $("#btn_approve_ids").click(function () {
                var selectedId = getSelectedId();
                if (!selectedId || selectedId == '[]' || selectedId.length == 0) {
                    $.alert.error("请至少选择一条记录");
                    return;
                }
               
                $('#whosapproveid').val(selectedId);
                $('#approveResultModalId').modal('show');
            });
            
            
            $("#btn-approve-yes").click(function () {
                var selectedId = getSelectedId();
                if (!selectedId || selectedId == '[]' || selectedId.length == 0) {
                    $.alert.error("请至少选择一条记录");
                    return;
                }
               
                $('#whosapproveid').val(selectedId);
                $('#approveResultModalId').modal('show');
            });
            
            $(".btn-approve-yes").unbind('click');
            $(".btn-approve-yes").click(function () {
                if (validator.checkAll($("#approveResultForm"))) {
                	$.ajax({
                        type: "post",
                        url: '/teacher/approveyes',
                        data: $("#approveResultForm").serialize(),
                        success: function (json) {
                        	//window.location.href='/child/evaluationContext/'+$('#whoschildid').val();
                            $("#approveResultModalId").modal('hide');
                            $("#tablelist").bootstrapTable('refresh', {url:'/teacher/list'});
                            $.alert.ajaxSuccess({'success':200,'message':json.message});
                        }
                    }); 
                }else{
            		$.alert.ajaxSuccess({'success':200,'message':'审批结果不能为空！'});
                	return false;
                }
            });
            
            $(".btn-approve-no").unbind('click');
            $(".btn-approve-no").click(function () {
                if (validator.checkAll($("#approveResultForm"))) {
                	$.ajax({
                        type: "post",
                        url: '/teacher/approveno',
                        data: $("#approveResultForm").serialize(),
                        success: function (json) {
                        	//window.location.href='/child/evaluationContext/'+$('#whoschildid').val();
                            $("#approveResultModalId").modal('hide');
                            $("#tablelist").bootstrapTable('refresh', {url:'/teacher/list'});
                            $.alert.ajaxSuccess({'success':200,'message':json.message});
                        }
                    }); 
                }else{
            		$.alert.ajaxSuccess({'success':200,'message':'审批结果不能为空！'});
                	return false;
                }
            });
            
            
            /* 审批老师上课课程 */
            $('#tablelist').on('click', '.btn-approve', function () {
                console.log("审批老师上课课程");
                var $this = $(this);
                var selectedId = $this.attr("data-id");
                $('#whosapproveid').val(selectedId);
                $('#approveResultModalId').modal('show');
                /* $.ajax({
                    type: "post",
                    url: '/child/get/'+childId,
                    success: function (json) {
                        var info = json.data;
                        $('#intEvaluation').val(info.intEvaluation);
                        $('#whoschildid').val(childId);
                        
                        
                        
                    }
                }); */
                
                
               /*  $.ajax({
                    async: false,
                    type: "POST",
                    data: {rid: coursesId},
                    url: '/resources/resourcesWithSelected',
                    dataType: 'json',
                    success: function (json) {
                        var data = json.data;
                        console.log(data);
                        var setting = {
                            check: {
                                enable: true,
                                chkboxType: {"Y": "ps", "N": "ps"},
                                chkStyle: "checkbox"
                            },
                            data: {
                                simpleData: {
                                    enable: true
                                }
                            },
                            callback: {
                                onCheck: function (event, treeId, treeNode) {
                                    console.log(treeNode.tId + ", " + treeNode.name + "," + treeNode.checked);
                                    var treeObj = $.fn.zTree.getZTreeObj(treeId);
                                    var nodes = treeObj.getCheckedNodes(true);
                                    var ids = new Array();
                                    for (var i = 0; i < nodes.length; i++) {
                                        //获取选中节点的值
                                        ids.push(nodes[i].id);
                                    }
                                    console.log(ids);
                                    console.log(coursesId);
                                    $.post(options.saveRolesUrl, {"courseId": coursesId, "resourcesId": ids.join(",")}, function (obj) { }, 'json');
                                }
                            }
                        };
                        var tree = $.fn.zTree.init($("#treeDemo"), setting, data);
                        tree.expandAll(true);//全部展开

                        $('#selectRole').modal('show');
                    }
                }); */
            });
        });
    </script>
</@footer>